package com.exadel;

import java.util.LinkedHashMap;

public class IntLinkedHashMapRun 
{
    public static void main( String[] args )
    {
    	put(1000000);
    	get(1000000);
        remove(1000000);
    }
    public static void put(int count){
    	IntLinkedHashMap myMap = new IntLinkedHashMap();
        LinkedHashMap<Integer, Integer> otherMap = new LinkedHashMap<Integer, Integer>();
        
        long Mytimerstart = System.currentTimeMillis();
        for(int i=1;i<count;i++){
        	myMap.put(i, i+100);
        }
        long Mytime = System.currentTimeMillis() - Mytimerstart;
        
        long otherTimerStart = System.currentTimeMillis();
        for(int i=1;i<count;i++){
        	otherMap.put(i, i+100);
        }
        long otherTime = System.currentTimeMillis() - otherTimerStart;
        
     
        	
        	System.out.println("-------------put--------------");
        	System.out.println("---my--------------standart---");
        	System.out.println("   "+Mytime + "             "+ otherTime);
        	
        	   System.out.println();
           	System.out.println();
           	System.out.println("--------current size----------");
           	System.out.println("---my--------------standart---");
           	System.out.println("   "+ myMap.size() + "             "+ otherMap.size());
    }
    
    public static void get(int count){
    	IntLinkedHashMap myMap = new IntLinkedHashMap();
    	LinkedHashMap<Integer, Integer> otherMap = new LinkedHashMap<Integer, Integer>();
        
        long Mytimerstart = System.currentTimeMillis();
        for(int i=1;i<count;i++){
        	myMap.get(i);
        }
        long Mytime = System.currentTimeMillis() - Mytimerstart;
        
        long otherTimerStart = System.currentTimeMillis();
        for(int i=1;i<count;i++){
        	otherMap.get(i);
        }
        long otherTime = System.currentTimeMillis() - otherTimerStart;
        
        
        	System.out.println();
        	System.out.println();
        	System.out.println("-------------get--------------");
        	System.out.println("---my--------------standart---");
        	System.out.println("   "+Mytime + "             "+ otherTime);
    }
    
    public static void remove(int count){
    	
    	IntLinkedHashMap myMap = new IntLinkedHashMap();
    	LinkedHashMap<Integer, Integer> otherMap = new LinkedHashMap<Integer, Integer>();
        
        for(int i=1;i<count;i++){
        	myMap.put(i, i+100);
        	otherMap.put(i, i+100);
        }
        
        long Mytimerstart = System.currentTimeMillis();
        for(int i=1;i<count;i++){
        	myMap.remove(i);
        }
        long Mytime = System.currentTimeMillis() - Mytimerstart;
        
        long otherTimerStart = System.currentTimeMillis();
        for(int i=1;i<count;i++){
        	otherMap.remove(i);
        }
        long otherTime = System.currentTimeMillis() - otherTimerStart;
        
        
        	System.out.println();
        	System.out.println();
        	System.out.println("------------remove------------");
        	System.out.println("---my--------------standart---");
        	System.out.println("   "+Mytime + "             "+ otherTime);
        	
        	System.out.println();
        	System.out.println();
        	System.out.println("--------current size----------");
        	System.out.println("---my--------------standart---");
        	System.out.println("   "+ myMap.size() + "             "+ otherMap.size());
    }
    
}
